/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package minimalshift;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import org.jgraph.JGraph;
import org.jgrapht.Graph;
import org.jgrapht.ext.JGraphModelAdapter;

/**
 *
 * @author Michal
 */
public class MinimalShift {

	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) {
		long start = System.nanoTime();
		FileReader fr = new FileReader("E:\\16shift3.txt");
		GraphManager gm = new GraphManager(fr.getShifts(), fr.getReqs(), fr.getIntervalLen());
		
		Graph<Integer, GraphEdge> graph = gm.getGraph();
		OutputProcessor proc = new OutputProcessor(graph, gm.minCostMaxFlow(), gm.getReqs(),gm.getBreakCycle());
		proc.process();
		long finish = System.nanoTime();
		System.out.println("Pocet smen z kterych jsme brali "+fr.getShifts().size());
		System.out.println("Cas behu " + (finish-start)/1000000 +" ms");
//
//		JGraph jgraph = new JGraph(new JGraphModelAdapter(gm.getGraph()));
//		JFrame frame = new JFrame();
//		jgraph.createImage(1600, 800);
//		frame.getContentPane().add(new JScrollPane(jgraph));
//		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//		frame.pack();
//		frame.setVisible(true);
	}
}